Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/LizandroCanul/back_sdo/llms.txt

Use this file to discover all available pages before exploring further.

Overview

Estatus de Obra (work status) defines the current state of public works projects such as “PROGRAMADA” (scheduled), “EN PROCESO” (in progress), “SUSPENDIDA” (suspended), or “TERMINADA” (completed). This catalog provides reference data for tracking project status.

Get All Work Statuses

Retrieves a list of all work status types in the system.

Authentication

This endpoint requires authentication using a Bearer token.

Response

id
number
required
Unique identifier for the work status
nombre
string
required
Name of the work status (max 50 characters, unique)
activo
boolean
required
Status flag indicating if this work status is active (default: true)

Example Request

curl --request GET \
  --url http://localhost:3000/estatus-obra \
  --header 'Authorization: Bearer YOUR_TOKEN'

Example Response

[
  {
    "id": 1,
    "nombre": "PROGRAMADA",
    "activo": true
  },
  {
    "id": 2,
    "nombre": "EN PROCESO",
    "activo": true
  },
  {
    "id": 3,
    "nombre": "SUSPENDIDA",
    "activo": true
  },
  {
    "id": 4,
    "nombre": "TERMINADA",
    "activo": true
  }
]

Get Work Status by ID

Retrieves a single work status by its unique identifier.

Authentication

This endpoint requires authentication using a Bearer token.

Path Parameters

id
number
required
The unique identifier of the work status to retrieve

Response

Returns a single work status object with the following fields:
id
number
required
Unique identifier for the work status
nombre
string
required
Name of the work status
activo
boolean
required
Status flag indicating if this work status is active

Example Request

curl --request GET \
  --url http://localhost:3000/estatus-obra/2 \
  --header 'Authorization: Bearer YOUR_TOKEN'

Example Response

{
  "id": 2,
  "nombre": "EN PROCESO",
  "activo": true
}

Error Responses

statusCode
number
HTTP status code (404 if work status not found)
message
string
Error message describing what went wrong
{
  "statusCode": 404,
  "message": "Work status not found"
}

Create Work Status

Creates a new work status in the system.

Authentication

This endpoint requires authentication using a Bearer token.

Request Body

nombre
string
required
Name of the work status (max 50 characters, must be unique)
activo
boolean
Status flag (defaults to true if not provided)

Validation Rules

  • nombre is required and must be a non-empty string
  • nombre must be unique across all work statuses
  • nombre is limited to 50 characters
  • activo is optional and defaults to true

Example Request

curl --request POST \
  --url http://localhost:3000/estatus-obra \
  --header 'Authorization: Bearer YOUR_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "nombre": "EN REVISIÓN",
    "activo": true
  }'

Example Response

{
  "id": 5,
  "nombre": "EN REVISIÓN",
  "activo": true
}

Error Response

{
  "statusCode": 400,
  "message": [
    "nombre should not be empty",
    "nombre must be a string"
  ],
  "error": "Bad Request"
}

Update Work Status

Updates an existing work status.

Authentication

This endpoint requires authentication using a Bearer token.

Path Parameters

id
number
required
The unique identifier of the work status to update

Request Body

All fields are optional. Only include fields you want to update.
nombre
string
Name of the work status (must be unique if provided)
activo
boolean
Status flag

Example Request

curl --request PATCH \
  --url http://localhost:3000/estatus-obra/5 \
  --header 'Authorization: Bearer YOUR_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "nombre": "PENDIENTE DE REVISIÓN"
  }'

Example Response

{
  "id": 5,
  "nombre": "PENDIENTE DE REVISIÓN",
  "activo": true
}

Delete Work Status

Deletes a work status from the system.

Authentication

This endpoint requires authentication using a Bearer token.

Path Parameters

id
number
required
The unique identifier of the work status to delete
Deleting a work status that is referenced by existing projects may fail due to foreign key constraints. Consider setting activo to false instead.

Example Request

curl --request DELETE \
  --url http://localhost:3000/estatus-obra/5 \
  --header 'Authorization: Bearer YOUR_TOKEN'

Example Response

{
  "message": "Work status deleted successfully"
}